<?php
  session_start();
  session_destroy();
  setcookie(session_name(),'',time()-3600);
  $_SESSION = array();
  
  $returnUrl = $_GET['ReturnUrl'];
  if(!isset($returnUrl))
  {                   
      header("Location: index.php");
  }
  else
  {
      header("Location: $returnUrl");
  }
?>